@extends('admin.base.widgets')

@section('content')
<div id="mws-container" class="clearfix">    
    <!-- Inner Container Start -->
     <div class="container"> 
		<div class="mws-panel grid_8">
                <div class="mws-panel-header">
                    <span>
                        <form action='/goods' method='get'>
                            商品名：<input type='text' name='goodsName'>
                            <input type='submit' class='btn' value='搜索'>
                            @if(session('msg'))
                                <script>alert("{{ session()->get('msg') }}")</script>
                            @endif
                        </form>
                        <form action='' method='post' name='myform'>
                            <input type='hidden' name='_token' value='{{ csrf_token() }}'>
                            <input type='hidden' name='_method' value='delete'>
                        </form>
                    </span>
                </div>
                <div class="mws-panel-body no-padding">
                    <table class="mws-datatable mws-table">
                        <thead>
                            <tr>
                                <th>序号</th>
                                <th>商品名</th>
                                <th>商品标题</th>
                                <th>商品品牌</th>
                                <th>商品价格</th>
                                <th>商品显示图</th>
                                <th>库存</th>
                                <th>商品介绍</th>
                                <th>回收站</th>
                                <th>商家</th>
                                <th>销量</th>
                                <th>商品详情</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody>
                            @foreach($list as $v)
                            <tr>
                                <td>{{ $v->GoodsId }}</td>
                                <td>{{ $v->GoodsName }}</td>
                                <td>{{ $v->GoodsTitle }}</td>
                                <td>{{ $v->GoodsBrand }}</td>
                                <td>{{ $v->GoodsPrice }}</td>
                                <td><img src="{{ asset('uploads/'.$v->GoodsPic) }}" width="100" height="100" /></td>
                                <td>{{ $v->GoodsStore }}</td>
                                <td>{{ $v->GoodsPresent }}</td>
                                <td>{{ $v->GoodsCycle==1?'在回收站':'正常' }}</td>
                                <td>{{ $v->GoodsMerchant }}</td>
                                <td>{{ $v->GoodsSales }}</td>
                                <td>{{ $v->GoodsDetail }}</td>
                                <td>
                                    <a href="/goods/{{ $v->GoodsId }}/edit">编辑</a>
                                    <a href="javascript:doDel({{ $v->GoodsId }})">删除</a>
                                </td>
                            </tr>
                            @endforeach
                        </tbody>
                    </table>
                </div>
            </div>
            <div id="paging">{{ $list->appends($where)->links() }}</div>
    </div>
</div>
        <script type="text/javascript">
            function doDel(id)
            {
                if(confirm('确定删除？')){
                    var form = document.myform;
                    form.action = '/goods/'+id;
                    form.submit();
                }
            }
        </script>
@endsection